<form class="form-inline" role="form"  method="post" action="/generate-chars.php">
    <div class="panel panel-default ">
        <?php
        require_once('functions.php');
        $res = mysql_query("SELECT COUNT(*) FROM aa_clear_accounts");
        $row = mysql_fetch_row($res);
        $rows_total = $row[0]; // всего записей
        ?>
        <div class="panel-heading">Всего чистых акков: <?=$rows_total?>
            <button onclick="return confirm('Пиздячим ?')" type="submit" class="btn btn-info" style="margin-left: 30px;">Генерировать</button>
            <button type="button" class="btn btn-info" data-dismiss="modal">Закрыть</button></div>
        <table class="table table-bordered table-hover table-condensed" >
            <tr class="info">
                <th>id серва</th>
                <th>Сервер</th>
                <th>Количество</th>
                <th>Добавить</th>
            </tr>
                <?php
                $query = "SELECT accounts.server AS TT, COUNT( * ) AS qtt, (
                        SELECT id
                        FROM  `aa_warehouses`
                        WHERE server = TT
                        LIMIT 1
                        ) AS serv_id
                        FROM  `accounts`
                        GROUP BY server
                        ORDER  BY `qtt` ASC";
                $result = mysql_query($query) or die("error 33");
                for ($c=0; $c<mysql_num_rows($result); $c++)
                {
                    $t = mysql_fetch_row($result);
                    echo "<tr>";
                    echo "<td>$t[2]</td>";
                    echo "<td>$t[0]</td>";
                    echo "<td>$t[1]</td>";
                    echo "<td>
                            <div class=\"input-group\">
                            <input  type=\"number\"   value='0' class=\"form-control\"   name='data[".$t[2]."]' ></input>
                            </div>
                          </td>";
                    echo "</tr>";

                }
                ?>
        </table>
    </div>

</form>
<div class="panel panel-default ">
